<template>
  <div>
    <!-- <h3>列表页</h3> -->
    <go-Back v-if="list.length>0"></go-Back>
    <go-search v-if="list.length>0"></go-search>
    <no-data v-if="list.length==0"></no-data>
    <div v-for="item in list" :key="item.id">
      <van-card
        :price="item.price"
        :title="item.title"
        :thumb="$pre + item.thumb"
        origin-price="10.00"
      />
    </div>
  </div>
</template>

<script>
import { reqList } from "../../http/http";
export default {
  data() {
    return {
      list: [],
    };
  },
  mounted() {
    // 接收search（问号）传参
    console.log(this.$route.query.id);
    reqList({
      cateid: this.$route.query.id,
      type: 1,
    }).then((res) => {
      console.log(res);
      if(res.data.list.goodData){
        this.list = res.data.list.goodData.map((item) => {
          return {
            id: item.id,
            price: item.price,
            title: item.goodsname,
            thumb: item.img,
          };
        });
      }
    });
  },
};
</script>

<style>
</style>